BKNAME=`nvram get wan_hostname`-backup-`date +%F`
DESTDIR=$BKNAME
cd /tmp
mkdir $DESTDIR
mount -o remount,ro /dev/mtdblock/4 /
dd if=/dev/mtdblock/1 > $DESTDIR/wrt-linux.trx
mount -o remount,rw /dev/mtdblock/4 /
dd if=/dev/mtdblock/3 > $DESTDIR/wrt-nvram.bin

tar czvf $BKNAME.tar.gz $DESTDIR
rm -rf $DESTDIR
cd -
